<script>
	export default {
		globalData: {
			ylRole: uni.getStorageSync('ylRole'),
			enterpriseCode: '220231031172250A002'
		},
		onLaunch: function() {
			console.log('App Launch')
			if (uni.getStorageSync('ylToken')) {
				uni.navigateTo({
					url: '/pages/home/home'
				})
			} else {
				uni.navigateTo({
					url: '/pages/home/home'
					// url: '/pages/login/login'
				})
			}
		},
		onShow: function() {
			console.log('App Show')
			this.updateApp()
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			updateApp(){
				console.log('检测更新')
				const updateManager = uni.getUpdateManager();
				
				updateManager.onCheckForUpdate(function (res) {
				  // 请求完新版本信息的回调
				  console.log(res.hasUpdate);
				});
				
				updateManager.onUpdateReady(function (res) {
				  uni.showModal({
				    title: '更新提示',
				    content: '新版本已经准备好，是否重启应用？',
				    success(res) {
				      if (res.confirm) {
				        // 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
				        updateManager.applyUpdate();
				      }
				    }
				  });
				
				});
				
				updateManager.onUpdateFailed(function (res) {
				  // 新的版本下载失败
				});
			}
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "uview-ui/index.scss";

	/*每个页面公共css */
	// @import '@/uni_modules/uni-scss/index.scss';
	// /* #ifndef APP-NVUE */
	/*每个页面公共css */
	@font-face {
		font-family: 'PingFangSC-Regular';
		src: url('https://bzhl-dev1.oss-cn-chengdu.aliyuncs.com/bzhl/miniapp/hjk/PingFang-SC-Regular.ttf');
		// src: url('https://www.your-server.com/PingFangSC-Medium.ttf');
		// url('~@/static/fonts/PingFang-SC-Regular.woff') format('woff'), /* Modern Browsers */
	}

	// 设置整个项目的背景色
	page {
		background-color: #f5f5f5;
		// font-family: 'PingFangSC-Regular';
		font-size: 24rpx;
	}

	view,
	text {
		// font-family: 'PingFangSC-Regular';
		font-size: 24rpx;
	}

	// /* #endif */
	.example-info {
		font-size: 14px;
		color: #333;
		padding: 10px;
	}

	.flex {
		display: flex;
	}

	.flexColumn {
		flex-direction: column;
	}

	.fcenter {
		justify-content: center;
		align-items: center;
	}

	.alignC {
		align-items: center;
	}

	.fjb {
		justify-content: space-between;
	}

	.btn {
		margin: 0;
		border-radius: 35rpx;
		font-size: 28rpx;
		padding: 10rpx 20rpx;
	}

	.btn_default {
		border: 1px solid #00B4C7;
		color: #00B4C7;
	}

	.btn_primary {
		background: #00B4C7;
		color: #fff;
	}

	.btn_success {
		width: 260rpx;
		height: 80rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		margin: 0 auto;
		border-radius: 40rpx;
		font-size: 34rpx;
	}

	.large_btn {
		margin-top: 20rpx;
		width: 90%;
		margin: 20rpx auto;
		height: 80rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 40rpx;
		// font-size: 34rpx;
		background: #00B4C7;
	}

	.card {
		// width: 92%;
		margin: 16rpx auto;
		border-radius: 16rpx;
		background: #fff;
		padding: 20rpx;
		font-size: 28rpx;

		.gap_row {
			margin-bottom: 20rpx;
		}

		.gap_clo {
			margin-right: 20rpx;
		}

		.title {
			font-size: 34rpx;
			color: #333;
		}

		.tag {
			background: #00B4C7;
			color: #fff;
			padding: 4rpx 8rpx;
			border-radius: 4rpx;
			width: fit-content;
			font-size: 24rpx;
		}
	}

	.u_cell {
		width: 94%;
		margin: 0 auto;
		border-radius: 32rpx;
		background: #fff;

		.cell_item {
			align-items: center;
			height: 100rpx;
			// width: 100%;
			// background: #fff;
			// margin-bottom: 20rpx;
			padding: 0 30rpx;
			// border-radius: 32rpx;

			text {
				color: #333;
				font-size: 28rpx;
			}

			image {
				width: 36rpx;
				height: 36rpx;
			}
		}

		.cell_item_left {
			justify-content: space-between;
		}

		.cell_item_center {
			justify-content: center;
		}
	}

	.large_font {
		font-size: 34rpx;
	}

	.middle_font {
		font-size: 28rpx;
	}

	.small_font {
		font-size: 24rpx;
	}

	.foot_box {
		position: fixed;
		bottom: 0;
		height: 180rpx;
		background: #fff;
		width: 100%;
		paddingg-top: 20rpx;
	}

	// 空状态
	.empty_box {
		image {
			width: 330rpx;
			height: 250rpx;
		}

		text {
			margin-bottom: 48rpx;
			margin-top: 20rpx;
			color: #999999;
			font-size: 28rpx;
		}

		border-radius: 16rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		margin: 100rpx;
		// background-color: #fff;
	}

	// 一行省略
	.line1 {
		overflow: hidden;
		word-break: break-all;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 1;
	}

	// 一行省略
	.line2 {
		overflow: hidden;
		word-break: break-all;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
	}
</style>